### -*- coding: utf-8 -*- #############################################
# Разработано компанией Ключевые Решения (http://keysolutions.ru/)
# Все права защищены, 2006-2007
#
# Developed by Key Solutions (http://keysolutions.ru/)
# All right reserved, 2006-2007
#######################################################################

"""

$Id: installcontentclass2resource.py 13 2007-11-27 21:44:13Z Arvi3D $
"""
__author__  = "Arvid"
__license__ = "KSL"
__version__ = "$Revision: 13 $"
__date__ = "$Date: 2007-11-27 21:44:13 +0000 (Tue, 27 Nov 2007) $"

from ks.contentclass2resource.resourcecontainer import ResourceContainer
from ks.contentclass2resource.resourcecontent import ResourceContent
from ks.contentclass2resource.interfaces import IResourceContainer

def installResourceContainer(context, **kw):
    u"""Устанавливает экземпляр ResourceContainer"""
    sm = context.getSiteManager()
    sm['ResourceContainer'] = ResourceContainer()
    obj = sm['ResourceContainer']

    # Добавляем основные контент-типы...
    obj['ks.content.textdocument.textdocument.TextDocument'] = ResourceContent()
    rc = obj['ks.content.textdocument.textdocument.TextDocument']
    rc.call = u'Текстовый документ'
    rc.icon = u'textdocument'
    rc.name__ = 'ks.content.textdocument.textdocument.TextDocument'

    obj['ks.content.eventfolder.eventfolder.EventFolder'] = ResourceContent()
    rc = obj['ks.content.eventfolder.eventfolder.EventFolder']
    rc.call = u'Папка событий'
    rc.icon = u'eventfolder'
    rc.name__ = 'ks.content.eventfolder.eventfolder.EventFolder'

    obj['ks.content.newsfolder.newsfolder.NewsFolder'] = ResourceContent()
    rc = obj['ks.content.newsfolder.newsfolder.NewsFolder']
    rc.call = u'Папка новостей'
    rc.icon = u'newsfolder'
    rc.name__ = 'ks.content.newsfolder.newsfolder.NewsFolder'

    obj['ks.content.event.event.Event'] = ResourceContent()
    rc = obj['ks.content.event.event.Event']
    rc.call = u'Событие'
    rc.icon = u'event'
    rc.name__ = 'ks.content.event.event.Event'

    obj['ks.content.news.news.News'] = ResourceContent()
    rc = obj['ks.content.news.news.News']
    rc.call = u'Новость'
    rc.icon = u'news'
    rc.name__ = 'ks.content.news.news.News'

    sm.registerUtility(obj, provided=IResourceContainer)
    return "OK"
